#%%
import numpy as np
import matplotlib.pyplot as plt
import math
from functools import partial, reduce

#%%

# FFT Func Simulation

x = np.arange(-10,10,0.1)
origin_func = lambda x,A=1.0,w=1.0: A*math.sin(w*x)/(math.pi*w)

func_set = [partial(origin_func, A=4.0, w=w_i)
            for w_i in [1.0, 3.0, 5.0, 7.0]]
compos_func = lambda x: np.sum([f(x) for f in func_set ])            

levle1_func = partial(origin_func, A=4.0, w=1.0)
levle2_func = partial(origin_func, A=4.0, w=3.0)
levle3_func = partial(origin_func, A=4.0, w=5.0)
levl43_func = partial(origin_func, A=4.0, w=7.0)

# y = list(map(origin_func, x))
# plt.plot(x, y, label='$\sin(x)$')

# for level, func_iter in enumerate(func_set):
#     y1 = list(map(func_iter,x))
#     plt.plot(x, y1, label=f'level {level}.')

y_fft = list(map(compos_func, x))
plt.plot(x, y_fft, label='FFT')
plt.legend()

#%%
